<template>
  <div>
    <Commonhead
      datum="我的跟帖"
      @click.native="$router.push('/mycenter')"
    ></Commonhead>
    <div class="big" v-for="comment in commentlist" :key="comment.id">
      <div class="box">
        <div class="time">2020-12-01</div>
        <div class="message" v-if="comment.parent">
          <div class="nickuser">回复：{{ comment.parent.user.nickname }}</div>
          <div class="cneter">{{ comment.parent.content }}</div>
        </div>
        <div class="answer">{{ comment.content }}</div>
        <div class="texts">
          <div class="text" v-if="comment.post">
            原文：{{ comment.post.title }}
          </div>
          <span class="iconfont iconjiantou1"></span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import Commonhead from "../../components/Commonhead";
export default {
  components: { Commonhead },

  data() {
    return {
      commentlist: [],
    };
  },

  created() {
    this.$axios({
      url: "user_comments",
      headers: { Authorization: localStorage.getItem("token") },
    }).then((res) => {
      console.log(res.data);
      this.commentlist = res.data.data;
    });
  },
};
</script>

<style lang="less" scoped>
.big {
  border-bottom: #e4e4e4 solid 2px;
  padding-bottom: 15/360 * 100vw;
  .box {
    margin: 0 10/360 * 100vw 0 10/360 * 100vw;
    .time {
      font-size: 16/360 * 100vw;
      color: #888;
    }
    .message {
      font-size: 14px;
      color: #888;
      background-color: #e4e4e4;
      padding: 10/360 * 100vw;
      margin: 10/360 * 100vw 0;
      .nickuser {
        padding-bottom: 5/360 * 100vw;
      }
      .center {
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
      }
    }
    .answer {
      margin: 10/360 * 100vw 0;
    }
    .texts {
      display: flex;
      .text {
        flex: 1;
        font-size: 14px;
        color: #888;
      }
    }
  }
}
</style>